(() => {
    return {
        name: "lzrs",
        description: "lzrs-request模式解析",
        version: "1.0.0",
        author: "lzrs.cc",
        search: {
            url: "https://lzrs.cc/vodsearch.html?wd={keyword}",
            description: "获取搜索列表",
            parse: function (html) {
                const $ = cheerio.load(html);
                const listItems = $(".module-items .module-item")
                    .map((index, element) => {
                        // 或者获取元素的特定属性
                        const href = $(element).find(".module-card-item-title a").attr("href");
                        const title = $(element).find(".module-card-item-title").text().trim();
                        const thumbnail = $(element).find(".module-item-pic img").data("original");
                        const score = $(element).find(".pic-tag-top").text().trim();
                        // 返回你需要的数据结构
                        return {
                            title,
                            href: "https://lzrs.cc" + href,
                            thumbnail,
                            score: '--',
                            source: "lzrs",
                        };
                    })
                    .get();
                return listItems;
            },
        },
        detail: {
            description: "详情页面，获取播放地址",
            parse: function (html) {
                const $ = cheerio.load(html);
                const playUrl = $('.module-info-content').find(".module-info-play a").attr("href");
                return "https://lzrs.cc" + playUrl;
            },
        },
        play: {
            description: "播放页面，获取真实播放地址",
            mediaType: "m3u8",
            parseType: "request",
            parse: function (urls) {
                if (urls instanceof Array) {
                    return urls.find(url => url.endsWith('m3u8'));
                } else {
                    return urls.split('|').find(url => url.endsWith('m3u8'));
                }
            },
        },
    };
})()